﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Kaskelot.SP.UI.Analys.Domain;

namespace Kaskelot.SP.UI.Analys
{
    public class ErrorHandler
    {
        private static ErrorHandler instance;

        public static ErrorHandler Instance 
        { 
            get
            {
                if (instance == null)
                    instance = new ErrorHandler();
                return instance;
            } 
        }

        public event EventHandler<GenericEventArgs<Exception>> OnError = delegate { };
        public event EventHandler<GenericEventArgs<object>> OnResetError = delegate { };

        public void HandleError(Exception ex)
        {
            OnError(this, new GenericEventArgs<Exception>(ex));
        }

        public void ClearError()
        {
            OnResetError(this, new GenericEventArgs<object>(null));
        }
    }
}
